Skip to content

refactor(theme): align with upstream shadcn tanstack start#6

Merged
ramonclaudio merged 2 commits intomainfrom
refactor/theme-provider-upstream
Apr 23, 2026
Merged

refactor(theme): align with upstream shadcn tanstack start#6
ramonclaudio merged 2 commits intomainfrom
refactor/theme-provider-upstream

Conversation

@ramonclaudio
Copy link
Copy Markdown
Owner

Swap the local ThemeProvider for the canonical shape merged in shadcn-ui/ui#10396 and drop the redundant next-themes dep.

The upstream docs ship a provider that uses ScriptOnce from @tanstack/react-router to inject the FOUC-guard script before hydration, a mount flag to defer effects past SSR, and a useTheme that throws when used outside the provider. Our version is now a byte-for-byte match apart from one return undefined to satisfy oxlint's consistent-return rule and oxfmt-driven whitespace.

Toaster previously pulled useTheme from next-themes, which was the only consumer of that package. It now reads from the local provider, so next-themes is gone from package.json.

Separately, .oxfmtrc.json now excludes convex/_generated/** so bun run fmt stops fighting Convex codegen (the generator rewrites semicolons on every convex dev).

  • src/components/theme-provider.tsx: rewrite to match shadcn-ui/ui#10396 (mount flag, getThemeScript, applyTheme(theme), throwing useTheme)
  • src/components/ui/sonner.tsx: swap next-themes for @/components/theme-provider, drop "use client"
  • package.json, bun.lock: remove next-themes
  • .oxfmtrc.json: add convex/_generated/** to ignorePatterns

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tanvex Ready Ready Preview, Comment Apr 23, 2026 3:18pm

@ramonclaudio ramonclaudio merged commit bf247ad into main Apr 23, 2026
2 checks passed
@ramonclaudio ramonclaudio deleted the refactor/theme-provider-upstream branch April 23, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant